package ${classPackageNameMap[table.className+'Example']};

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
/**
 * @author ${author!}
 * @since ${timeNow!}
 * ${table.remarks!}
 */
@Getter
@Setter
public class ${table.className}Example {
    /** orderByClause */
    protected String orderByClause;
    /** limit */
    protected Integer limitByClause;
    /** distinct */
    protected boolean distinct;
    /** oredCriteria */
    protected List<Criteria> oredCriteria;
    /** Constructor */
    public ${table.className}Example() {
        oredCriteria = new ArrayList<>();
    }
    /** or */
    public void or(Criteria criteria) {
        oredCriteria.add(criteria);
    }
    /** or */
    public Criteria or() {
        Criteria criteria = createCriteriaInternal();
        oredCriteria.add(criteria);
        return criteria;
    }
    /** createCriteria */
    public Criteria createCriteria() {
        Criteria criteria = createCriteriaInternal();
        if (oredCriteria.isEmpty()) {
            oredCriteria.add(criteria);
        }
        return criteria;
    }
    /** createCriteriaInternal */
    protected Criteria createCriteriaInternal() {
        Criteria criteria = new Criteria();
        return criteria;
    }
    /** clear */
    public void clear() {
        oredCriteria.clear();
        orderByClause = null;
        distinct = false;
    }
    /** GeneratedCriteria */
    protected abstract static class GeneratedCriteria {
        /** criteria */
        protected List<Criterion> criteria;
        /** GeneratedCriteria */
        protected GeneratedCriteria() {
            super();
            criteria = new ArrayList<>();
        }
        /** isValid */
        public boolean isValid() {
            return !criteria.isEmpty();
        }
        /** getAllCriteria */
        public List<Criterion> getAllCriteria() {
            return criteria;
        }
        /** getCriteria */
        public List<Criterion> getCriteria() {
            return criteria;
        }
        /** addCriterion */
        protected void addCriterion(String condition) {
            if (condition == null) {
                throw new RuntimeException("Value for condition cannot be null");
            }
            criteria.add(new Criterion(condition));
        }
        /** addCriterion */
        protected void addCriterion(String condition, Object value, String property) {
            if (value == null) {
                throw new RuntimeException("Value for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value));
        }
        /** addCriterion */
        protected void addCriterion(String condition, Object value1, Object value2, String property) {
            if (value1 == null || value2 == null) {
                throw new RuntimeException("Between values for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value1, value2));
        }
      <#list table.columns as column>
        /** addCriterion */
        public Criteria and${column.fieldName}IsNull() {
            addCriterion("${column.columnName} is null");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}IsNotNull() {
            addCriterion("${column.columnName} is not null");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}EqualTo(${column.fieldType} value) {
            addCriterion("${column.columnName} =", value, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}NotEqualTo(${column.fieldType} value) {
            addCriterion("${column.columnName} <>", value, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}GreaterThan(${column.fieldType} value) {
            addCriterion("${column.columnName} >", value, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}GreaterThanOrEqualTo(${column.fieldType} value) {
            addCriterion("${column.columnName} >=", value, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}LessThan(${column.fieldType} value) {
            addCriterion("${column.columnName} <", value, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}LessThanOrEqualTo(${column.fieldType} value) {
            addCriterion("${column.columnName} <=", value, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }
      <#if column.fieldType == "String">

        public Criteria and${column.fieldName}Like(String value) {
            addCriterion("${column.columnName} like", value, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}NotLike(String value) {
            addCriterion("${column.columnName} not like", value, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }
      </#if>

        public Criteria and${column.fieldName}In(List<${column.fieldType}> values) {
            addCriterion("${column.columnName} in", values, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}NotIn(List<${column.fieldType}> values) {
            addCriterion("${column.columnName} not in", values, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}Between(${column.fieldType} value1, ${column.fieldType} value2) {
            addCriterion("${column.columnName} between", value1, value2, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }

        public Criteria and${column.fieldName}NotBetween(${column.fieldType} value1, ${column.fieldType} value2) {
            addCriterion("${column.columnName} not between", value1, value2, "${column.fieldNameFirstLower}");
            return (Criteria) this;
        }
      </#list>
    }
    /** */
    public static class Criteria extends GeneratedCriteria {
        protected Criteria() {
            super();
        }
    }
    /** */
    public static class Criterion {
        private String condition;

        private Object value;

        private Object secondValue;

        private boolean noValue;

        private boolean singleValue;

        private boolean betweenValue;

        private boolean listValue;

        private String typeHandler;

        public String getCondition() {
            return condition;
        }

        public Object getValue() {
            return value;
        }

        public Object getSecondValue() {
            return secondValue;
        }

        public boolean isNoValue() {
            return noValue;
        }

        public boolean isSingleValue() {
            return singleValue;
        }

        public boolean isBetweenValue() {
            return betweenValue;
        }

        public boolean isListValue() {
            return listValue;
        }

        public String getTypeHandler() {
            return typeHandler;
        }

        protected Criterion(String condition) {
            super();
            this.condition = condition;
            this.typeHandler = null;
            this.noValue = true;
        }

        protected Criterion(String condition, Object value, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.typeHandler = typeHandler;
            if (value instanceof List<?>) {
                this.listValue = true;
            } else {
                this.singleValue = true;
            }
        }

        protected Criterion(String condition, Object value) {
            this(condition, value, null);
        }

        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
            super();
            this.condition = condition;
            this.value = value;
            this.secondValue = secondValue;
            this.typeHandler = typeHandler;
            this.betweenValue = true;
        }

        protected Criterion(String condition, Object value, Object secondValue) {
            this(condition, value, secondValue, null);
        }
    }
}